<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ include file="/admin/jsp/taglibs.jsp"%>
<html>
	<head>
		<%@ include file="/admin/jsp/header.jsp"%>
		<%@ include file="/framework/jsp/calendar.jsp"%>
		<%@ include file="/framework/jsp/tablesorter.jsp"%>
	</head>
	<body onload="init();">
		<table width="98%" border="0" align="center" cellpadding="3" cellspacing="0">
			<tr>
				<td class="page-title">
					<img src="../images/page_title.gif" alt="title" width="17" height="12">
					&nbsp;&nbsp; 系统管理 » 白名单管理



				</td>
			</tr>
		</table>
		<br>
		<form id="mainForm" action="/admin/jsp/whiteMobile.do?method=queryWhiteMobile" method="post">
			<input type="hidden" name="pageNo" id="pageNo" value="${page.pageNo}" />
			<input type="hidden" name="pageSize" id="pageSize" value="${page.pageSize}" />
			<input type="hidden" name="orderBy" id="orderBy" value="${page.orderBy}" />
			<input type="hidden" name="order" id="order" value="${page.order}" />
			<fieldset style="width: 98%; padding: 10px">
				<legend>
					白名单查询


				</legend>
				<table width="80%" height="50" border="0" cellpadding="0" cellspacing="0">
					<tr>
						<td>
							手机号码:
							<input type="text" name="filter_LIKE_terminalId" id="terminalId" value='<c:out value="${param['filter_LIKE_terminalId']}"/>'>
						</td>
						<td>
							业务级别:
							<select name="filter_EQ_bizId" id="bizId">
								<option value="">--请选择--</option>
								<c:forEach var="biz" items="${bizList}">
									<option value="<c:out value='${biz.bizId}'/>"><c:out value="${biz.bizName}"/></option>
								</c:forEach>
							</select>
						</td>
						<td>
							录入时间:
							
							<input type="text" name="filter_GE_updateTime" id="updateTimeS" value="${param['filter_GE_updateTime']}" size="8" readonly>
							&nbsp;
							<img id="startBtn" style="cursor: hand" src="../images/calendar.gif" />	
							-
							<input type="text" name="filter_LE_updateTime" id="updateTimeE" value="${fn:substring(param['filter_LE_updateTime'], 0, 8)}" size="8" readonly>
							&nbsp;
							<img id="endBtn" style="cursor: hand" src="../images/calendar.gif" />
						</td>
					</tr>
					<tr>
						<td></td>
						<td></td>
						<td align="right">
							<input type="submit" class="short-button" value="查  询" onclick="search()"/>
						</td>
					</tr>
				</table>
			</fieldset>
			<table width="90%" border="0" cellpadding="0" cellspacing="0">
				<tr>
					<td>
						<input type="button" class="short-button" value="新  增" onclick="javascript:window.location='/admin/jsp/whiteMobile.do?method=addWhiteMobile'" />
						&nbsp;&nbsp;&nbsp;
						<input type="button" class="short-button" value="批量删除" onclick="delMultWhiteMobile()" />
					</td>
				</tr>
			</table>
			<table id="tableList" cellspacing="1" class="tablesorter" width="90%">
				<thead>
					<tr align="center">						
						<th class="{sorter: false}" width="4%">
							<input class="checkbox" type="checkbox" name="operId" onclick="javascript:selectAll('id',this.checked)">
						</th>	
						<th>
							序号
						</th>
						<th>
							<a href="javascript:sort('terminalId','asc')">白名单</a>
						</th>			
						<th>
							<a href="javascript:sort('updateTime','asc')">录入时间</a>
						</th>
						<th>
							备注
						</th>
						<th>
							业务级别
						</th>
						<th class="{sorter: false}">
							操作
						</th>
					</tr>
				</thead>
				<tbody>
				<c:if test="${page.totalCount != '0'}">
						<c:forEach var="whiteMobile" items="${page.result}" varStatus="status">
							<tr align="center">								
								<td>
									<input class="checkbox" type="checkbox" name="id" value="<c:out value='${whiteMobile.id}' />" />
								</td>
								<td>
									<c:out value="${status.index+1}"/>
								</td>
								<td>
									<c:out value="${whiteMobile.terminalId}" />
								</td>
								<td>
									<fmt:parseDate pattern="yyyyMMddHHmmss" var="parsedDateTime" parseLocale="en_US">
										<c:out value="${whiteMobile.updateTime}" />
									</fmt:parseDate>
									<fmt:formatDate value='${parsedDateTime}' pattern="yyyy.MM.dd HH:mm:ss"/>
								</td>
								<td>
									<c:out value="${whiteMobile.terminalDesc}" />
								</td>
								<td>
									<c:choose>
										<c:when test="${whiteMobile.bizId!=''}">
											<c:out value="${whiteMobile.bizName}"></c:out>
										</c:when>
									</c:choose>
								</td>
								<td>
									<img src="../images/modp.gif" title="修改" style="cursor: pointer" onclick="editWhiteMobile(<c:out value='${whiteMobile.id}' />)">
									<img src="../images/delp.gif" title="删除" style="cursor: pointer" onclick="delWhiteMobile(<c:out value='${whiteMobile.id}' />)">
								</td>
							</tr>
						</c:forEach>
					</c:if>
					<c:if test="${page.totalCount == '0'}">
						<tr align="center">
							<td colspan="4" align="left">
								暂无符合条件的记录


							</td>
						</tr>
				</c:if>
				</tbody>
			</table>
			<div>
				<jsp:include page="/framework/jsp/pager.jsp" flush="true" />
			</div>
		</form>
	</body>
	<script type="text/javascript">
function init()
	{
		var bizId = "${param['filter_EQ_bizId']}";
		document.getElementById("bizId").value = bizId;
	}
	
	//查询
	function search(){
		testTime();
		if(tag==true){
			$("#order").val("desc");
			$("#orderBy").val("updateTime");
			$("#pageNo").val("1");
			$("#pageSize").val("5");
			$("#mainForm").submit();
		}else{
			return(false);
		}
	}
	
	var tag=true;
	//对时间进行验证
	function testTime(){
		var updateTimeS=document.getElementById("updateTimeS").value;
		var updateTimeE=document.getElementById("updateTimeE").value;
		if(updateTimeS!=null && updateTimeS!="" && updateTimeE!=null && updateTimeE!=""){
			if(updateTimeS - updateTimeE<=0){
				document.getElementById("updateTimeE").value=updateTimeE+"235959";
			}else{
				alert('开始时间不能大于结束时间，请重新选择');	
				document.getElementById("updateTimeS").value="";
				document.getElementById("updateTimeE").value="";
				tag=false
				return(false);	
			}
		}
	}

	//编辑黑名单
	function editWhiteMobile(id)
	{
		window.location='/admin/jsp/whiteMobile.do?method=editWhiteMobile&&id='+id;
	}
	
	//删除白名单
	function delWhiteMobile(id){
		if(confirm("您确定删除该白名单吗?\n"))
			window.location='/admin/jsp/whiteMobile.do?method=delWhiteMobile&id='+id;
	}
	
	//批量删除白名单
	function delMultWhiteMobile(){
		if(getCheckboxCheckedValue("id") != ""){
			if(confirm("您确定删除所选白名单吗?\n")==true){					
				document.getElementById("mainForm").action = "/admin/jsp/whiteMobile.do?method=delWhiteMobiles";
				document.getElementById("mainForm").submit();
			}
		}else{
			alert("请选择需要删除的白名单！");
		}
	}
	
	Calendar.setup(
	{
      inputField  : "updateTimeS",         // ID of the input field
      ifFormat    : "%Y%m%d",    // the date format
      button      : "startBtn"       // ID of the button
	});
	Calendar.setup(
	{
      inputField  : "updateTimeE",         // ID of the input field
      ifFormat    : "%Y%m%d",    // the date format
      button      : "endBtn"       // ID of the button
	});
	</script>
</html>